package com.kgc.dao;

import com.kgc.entity.Admin;

import java.sql.ResultSet;
import java.sql.SQLException;

public class AdminDao extends BaseDao{
    public  Admin selectLogin(String email) {
        try {
            String sql = "select * from admin where email=?";
            ResultSet rs = super.getExecuteQuery(sql, email);
            while (rs.next()) {
                return new Admin(rs.getInt(1),
                        rs.getString(2),
                        rs.getString(3),
                        rs.getString(4),
                        rs.getInt(5),
                        rs.getString(6),
                        rs.getString(7)
                );
            }
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        } finally {
            super.closeConnection();
        }
        return null;
    }
}
